﻿using System;
using System.IO;
using System.Xml;
using Windows.Storage;
using CeskyRozhlasRT.Utils;

namespace Win81AppTests.DataModel
{
    public class Win81LocalAssetManager:IAssetManager, IDisposable
    {
        private StorageFile _mTestXmlStream = null;
        public XmlReader GetXmlReader(string iUri)
        {
            var aUri = new Uri(@"ms-appx:///" + iUri);
            _mTestXmlStream = Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(aUri).AsTask().Result;
            return XmlReader.Create(_mTestXmlStream.OpenReadAsync().AsTask().Result.AsStreamForRead());
        }

        public void Dispose()
        {
                _mTestXmlStream = null;
        }
    }
}
